<div class="layui-card-body">
    <form class="layui-form" action="{:url()}"  method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-block">
                <input type="text" name="title" value="{$info.title|default=''}" class="layui-input" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">微信图文素材</label>
            <div class="layui-input-block">
                <select lay-filter="wechat">
                    <option value=""> 如是微信里图文请选择</option>
                    <volist name="list" id="vo" key="k">
                        <option value="{$vo['content']['news_item'][0]['url']} ">
                            {$vo['content']['news_item'][0]['title']}
                        </option>
                    </volist>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">链接</label>
            <div class="layui-input-block">
                <input type="text" name="url" value="{$info.url|default=''}" class="layui-input" autocomplete="off"
                       id="url">
            </div>
        </div>

        <div class="layui-col-md6">
            <div class="layui-form-item">
                <label class="layui-form-label">图片</label>
                <div class="avatar-add" style="margin-left: 110px;">
                    <p>建议能看清就好，支持jpg、png、gif，建议尽寸900*500</p>
                    <div class="upload-img">
                        <button type="button" class="layui-btn layui-btn-primary" id="test1">
                            <i class="layui-icon">&#xe67c;</i>上传图片
                        </button>
                    </div>
                    <style>
                        .img2 img {
                            borde-radius: 1%;
                            position: absolute;
                            left: 45%;
                            top: 50%;
                            width: 200px;
                            margin: -50px 0 0 -84px;
                            overflow: hidden;
                        }
                    </style>
                    <div class="img2">
                        <img src="{$info.img|default=''}">
                    </div>
                    <span class="loading"></span>
                </div>
            </div>
            <input type="hidden" name="img" value="{$info.img|default=''}" id="img">
        </div>
        <input type="hidden" name="id" value="{$info.id|default=''}">
    </form>

</div>
<link rel="stylesheet" href="https://cdn.weibuyun.com/static/admin/plugins/formSelects-v4.css">
<script charset="utf-8" src="https://cdn.weibuyun.com/static/admin/plugins/wangeditor/wangEditor.min.js"></script>
<script type="text/javascript">
    layui.use(['form', 'layer', 'formSelects', 'upload'], function () {
        var form = layui.form
            , formSelects = layui.formSelects
            , $ = layui.$
            , upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#test1',
            url: '{:url("/file/upload",["type"=>"image"])}',
            done: function (res) {
                var input = '#test1';
                $(input).closest('.avatar-add').find('.loading').hide();
                if (res.code == 0) {
                    $(input).closest('.avatar-add').find('img').attr('src', res.data.src);
                    $('#img').val(res.data.src);
                } else {
                    layer.msg(res.msg);
                }
            }

        });
        form.on('select(wechat)', function (data) {

            console.log(data.value); //得到被选中的值
            $('#url').val(data.value);
        });


    });
</script>






